package cn.itcast.exam.service.impl;

import cn.itcast.exam.dao.UserDao;
import cn.itcast.exam.dao.impl.UserDaoimpl;
import cn.itcast.exam.pojo.User;
import cn.itcast.exam.service.UserService;
import com.alibaba.fastjson.JSON;

import java.util.HashMap;

public class UserServiceimpl implements UserService {
    private UserDao userDao=new UserDaoimpl();
    @Override
    public String loginService(User user) {
     Integer num= userDao.loginDao(user);
        HashMap<String, Object> map = new HashMap<>();

        if (num==1){
         map.put("flag",true);
     }if (num==0){
            map.put("flag",false);
            map.put("errormsg","登陆失败密码或者账号错误");
        }
        return JSON.toJSONString(map);

    }
}
